package com.example.demo.service.Imp;

import com.example.demo.dao.UserMapper;
import com.example.demo.model.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 编写者：施皓
 * 编写时间：2019.5.27
 */
@Service
    public class UserServiceImp implements UserService {
        @Autowired
        private UserMapper UserMapper;

        @Override
        public User selectByPrimaryKey(Integer uid)
        {
            return UserMapper.selectByPrimaryKey(uid);
        }

    @Override
    public List<User> shiKey(String selrisbegin)
    {

        return UserMapper.shiKey(selrisbegin);
    }
    @Override
    public List<User> selectByPrimaryKey(int uid)
    {

        return UserMapper.selectByPrimaryKey(uid);
    }

    @Override
    public List<User> getrpart()
    {

        return UserMapper.getrpart();
    }

    @Override
    public List<User> getdsex()
    {

        return UserMapper.getdsex();
    }

    @Override
    public List<User> getdjur()
    {

        return UserMapper.getdjur();
    }

    @Override
    public List<User> getdoffice()
    {

        return UserMapper.getdoffice();
    }

    @Override
    public List<User> getiorg()
    {

        return UserMapper.getiorg();
    }
        @Override
        public List<User> getIsBegin() {
            System.out.println("执行角色类型SQL语句");
            return UserMapper.getIsBegin();
        }

        @Override
        public List<User> getAll() {
            List<User> lidy=UserMapper.getAll();
            return lidy;
        }

        @Override
        public int delRole(Integer uid) {
            System.out.println("删除的主键是" + uid);
            return UserMapper.delRole(uid);
        }

        @Override
        public int insertRole(User usermodel) {
            return UserMapper.insertRole(usermodel);
        }

        @Override
        public int updateRole(User usermodel) {
            return UserMapper.updateRole(usermodel);
        }
//执行业务判断
    @Override
    public String getUser(User usermodel) {
            String tempStr="123";
      List<User> userList=UserMapper.getUser(usermodel);
      if(!userList.isEmpty()){
          System.out.println(userList.size());
          if (userList.size()>0) {
              tempStr = "ok";
          }
      }
        return tempStr;
    }
}
